//package com.thinksns.sociax.t4.android.fragment;
//
//import android.app.Activity;
//import android.content.Context;
//import android.content.Intent;
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.Message;
//import android.text.TextUtils;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.AbsListView;
//import android.widget.AdapterView;
//import android.widget.LinearLayout;
//import android.widget.RelativeLayout;
//import android.widget.TextView;
//
//import com.amap.api.location.AMapLocation;
//import com.amap.api.location.AMapLocationClient;
//import com.amap.api.location.AMapLocationClientOption;
//import com.amap.api.location.AMapLocationListener;
//import com.scwang.smartrefresh.layout.SmartRefreshLayout;
//import com.scwang.smartrefresh.layout.api.RefreshLayout;
//import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
//import com.thinksns.sociax.android.R;
//import com.thinksns.sociax.api.Api;
//import com.thinksns.sociax.t4.adapter.AdapterFindListview;
//import com.thinksns.sociax.t4.android.Listener.UnreadMessageListener;
//import com.thinksns.sociax.t4.android.Thinksns;
//import com.thinksns.sociax.t4.android.activity.InformationDetailsActivity;
//import com.thinksns.sociax.t4.android.cache.CacheManager;
//import com.thinksns.sociax.t4.android.channel.ActivityChannel;
//import com.thinksns.sociax.t4.android.channel.ActivityChannelWeibo;
//import com.thinksns.sociax.t4.android.data.StaticInApp;
//import com.thinksns.sociax.t4.android.event.EventActivity;
//import com.thinksns.sociax.t4.android.event.EventDetailActivity;
//import com.thinksns.sociax.t4.android.findpeople.ActivityFindPeople;
//import com.thinksns.sociax.t4.android.findpeople.ActivitySearchUser;
//import com.thinksns.sociax.t4.android.function.FunctionAdvertise;
//import com.thinksns.sociax.t4.android.gift.ActivityGiftDetail;
//import com.thinksns.sociax.t4.android.gift.ActivityScoreShop;
//import com.thinksns.sociax.t4.android.info.ActivityInformation;
//import com.thinksns.sociax.t4.android.jipu.JiPuShopActivity;
//import com.thinksns.sociax.t4.android.topic.ActivityTopicList;
//import com.thinksns.sociax.t4.android.topic.ActivityTopicWeibo;
//import com.thinksns.sociax.t4.android.user.ActivityUserInfo_2;
//import com.thinksns.sociax.t4.android.video.ToastUtils;
//import com.thinksns.sociax.t4.android.weiba.ActivityWeiba;
//import com.thinksns.sociax.t4.android.weiba.ActivityWeibaDetail;
//import com.thinksns.sociax.t4.android.widget.HorizontalListView;
//import com.thinksns.sociax.t4.component.SmallDialog;
//import com.thinksns.sociax.t4.model.EventTopModel;
//import com.thinksns.sociax.t4.model.FindListviewModel;
//import com.thinksns.sociax.t4.model.ModelAds;
//import com.thinksns.sociax.t4.model.ModelNotification;
//import com.thinksns.sociax.t4.model.ModelShopGift;
//import com.thinksns.sociax.t4.model.ModelUser;
//import com.thinksns.sociax.t4.model.ModelWeiba;
//import com.thinksns.sociax.thinksnsbase.bean.ListData;
//import com.thinksns.sociax.thinksnsbase.bean.SociaxItem;
//import com.thinksns.sociax.thinksnsbase.exception.ApiException;
//import com.thinksns.sociax.thinksnsbase.network.ApiHttpClient;
//import com.thinksns.sociax.thinksnsbase.utils.UnitSociax;
//import com.thinksns.sociax.unit.SociaxUIUtils;
//
//import org.json.JSONArray;
//import org.json.JSONException;
//import org.json.JSONObject;
//
//import java.io.Serializable;
//import java.util.ArrayList;
//import java.util.List;
//
//
///**
// * 类说明：发现模块
// *
// * @author wz
// * @version 1.0
// * @date 2015-1-4
// */
//public class FragmentFind extends FragmentSociax implements AdapterView.OnItemClickListener, AMapLocationListener, OnRefreshListener {
//    private static final int MAX_LINE_ONE = 1;
//    private static final int MAX_LINE_TWO = 2;
//    private static final String CACHE_KEY = "cache_find";
//    private static final String NEEDS = "1,2,3,4,5,6,7,8,11";  // 1-轮播图 2-微吧 3-话题 4-频道 5-资讯 6-找人 7-附近的人 8-积分商城 9-直播 10-极铺商品 11-活动
//    private static final String NEEDS_TYPE = ApiHttpClient.getApiUrl() + "system"; // 默认系统版，用于接口缓存
//    private static FragmentFind fragmentFind; // 类实例
//    private SmartRefreshLayout mSmartRefreshLayout; // 下拉刷新的 scrollView
//    private TextView tv_center; // 标题
//    private FunctionAdvertise fc_ads; // 广告 banner
//    private LinearLayout ll_find_weiba; // 发现--微吧
//    private LinearLayout ll_find_topic; // 发现--话题
//    private LinearLayout ll_find_channal; // 发现--频道
//    private LinearLayout ll_find_info; // 发现--资讯
//    private LinearLayout ll_find_find; // 发现--找人
//    private LinearLayout ll_find_near; // 发现--附近的人
//    private LinearLayout ll_find_gift; // 发现--积分商城
//    private LinearLayout ll_find_jipu; // 发现--极铺
//    private LinearLayout ll_find_event;// 发现--活动
//    private LinearLayout ll_zhibo; // 发现--直播
//    // 每部分对应的 listView
//    private HorizontalListView lv_zhibo;
//    private HorizontalListView lv_weiba;
//    private HorizontalListView lv_huati;
//    private HorizontalListView lv_chanel;
//    private HorizontalListView lv_zixun;
//    private HorizontalListView lv_find;
//    private HorizontalListView lv_near;
//    private HorizontalListView lv_gift;
//    private HorizontalListView lv_jipu; // 极铺接入入口
//    private HorizontalListView lv_event;
//    // 每部分 listView 对应的 adapter
//    private AdapterFindListview adapter_zhibo;
//    private AdapterFindListview adapter_weiba;
//    private AdapterFindListview adapter_huati;
//    private AdapterFindListview adapter_chanel;
//    private AdapterFindListview adapter_zixun;
//    private AdapterFindListview adapter_find;
//    private AdapterFindListview adapter_near;
//    private AdapterFindListview adapter_gift;
//    private AdapterFindListview adapter_jipu;
//    private AdapterFindListview adapter_event;
//
//    private AMapLocationClient locationClient = null;
//    private AMapLocationClientOption locationOption = null;
//    private SmallDialog smallAddDialog;
//    private UnreadMessageListener listener;
//    private int weibaUnread = 0;        //微吧消息未读数
//    private int list_item_height = 0;
//    private int list_item_height_five = 0;
//    private List<ModelWeiba> weiba_data;
//    private List<EventTopModel> eventTops;
//    private double mLatitude, mLongitude;
//
//    private Handler myHandler = new Handler() {
//        @Override
//        public void handleMessage(Message msg) {
//            if (smallAddDialog.isShowing()) {
//                smallAddDialog.dismiss();
//            }
//            if (mSmartRefreshLayout != null) {
//                mSmartRefreshLayout.finishRefresh();
//            }
//            String result = (String) msg.obj;
//            if (TextUtils.isEmpty(result)) {
//                return;
//            }
//
//            try {
//                JSONObject js = new JSONObject(result);
//                if (js.has("banner")) { // 广告栏数据
//                    ListData<SociaxItem> data = new ListData<>();
//                    JSONArray adsArr = js.optJSONArray("banner");
//                    ModelAds ads;
//                    if (adsArr != null && adsArr.length() > 0) {
//                        for (int i = 0; i < adsArr.length(); i++) {
//                            ads = new ModelAds(adsArr.optJSONObject(i));
//                            data.add(ads);
//                        }
//                    }
//                    fc_ads.setAdsData(data);
//                }
//                if (js.has("weibas")) { // 微吧数据
//                    List<FindListviewModel> data = new ArrayList<>();
//                    weiba_data = new ArrayList<>();
//                    JSONArray weibas = js.optJSONArray("weibas");
//                    if (weibas != null && weibas.length() > 0) {
//                        for (int i = 0; i < weibas.length(); i++) {
//                            JSONObject j = (JSONObject) weibas.optJSONObject(i);
//                            ModelWeiba w = new ModelWeiba(j);
//                            weiba_data.add(w);
//                        }
//                        for (int i = 0; i < weiba_data.size(); i++) {
//                            ModelWeiba w = weiba_data.get(i);
//                            String url = w.getAvatar_middle();
//                            int id = w.getWeiba_id();
//                            String bottom = w.getWeiba_name();
//                            data.add(new FindListviewModel(url, "", bottom, id, 1));
//                        }
//                    }
//
//                    adapter_weiba.refresh(data);
//                    if (data.size() == 0) {
//                        lv_weiba.setVisibility(View.GONE);
//                    } else {
//                        lv_weiba.setVisibility(View.VISIBLE);
//                    }
//                }
//                if (js.has("topics")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray topics = js.optJSONArray("topics");
//                    if (topics != null && topics.length() > 0) {
//                        for (int i = 0; i < topics.length(); i++) {
//                            JSONObject j = (JSONObject) topics.optJSONObject(i);
//                            String url = j.optString("pic");
//                            int id = j.optInt("topic_id");
//                            String center = j.optString("topic_name");
//                            data.add(new FindListviewModel(url, center, "", id, 0));
//                        }
//                    }
//                    adapter_huati.refresh(data);
//                    if (data.size() == 0) {
//                        lv_huati.setVisibility(View.GONE);
//                    } else {
//                        lv_huati.setVisibility(View.VISIBLE);
//                    }
//                }
//                if (js.has("channels")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray channels = js.optJSONArray("channels");
//                    if (channels != null && channels.length() > 0) {
//                        for (int i = 0; i < channels.length(); i++) {
//                            JSONObject j = (JSONObject) channels.optJSONObject(i);
//                            String url = j.optString("pic");
//                            int id = j.optInt("channel_category_id");
//                            String center = j.optString("title");
//                            data.add(new FindListviewModel(url, center, "", id, 0));
//                        }
//                    }
//                    adapter_chanel.refresh(data);
//                    if (data.size() == 0) {
//                        lv_chanel.setVisibility(View.GONE);
//                    } else {
//                        lv_chanel.setVisibility(View.VISIBLE);
//                    }
//                }
//
//                if (js.has("information")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray information = js.optJSONArray("information");
//                    if (information != null && information.length() > 0) {
//                        for (int i = 0; i < information.length(); i++) {
//                            JSONObject j = (JSONObject) information.optJSONObject(i);
//                            String url = j.optString("pic");
//                            int id = j.optInt("id");
//                            String bottom = j.optString("subject");
//                            String detail_url = j.optString("url");
//                            FindListviewModel f = new FindListviewModel(url, "", bottom, id, 1);
//                            f.setUrl(detail_url);
//                            data.add(f);
//                        }
//                    }
//                    adapter_zixun.refresh(data);
//                    if (data.size() == 0) {
//                        lv_zixun.setVisibility(View.GONE);
//                    } else {
//                        lv_zixun.setVisibility(View.VISIBLE);
//                    }
//                }
//                if (js.has("users")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray users = js.optJSONArray("users");
//                    if (users != null && users.length() > 0) {
//                        for (int i = 0; i < users.length(); i++) {
//                            JSONObject j = (JSONObject) users.optJSONObject(i);
//                            String url = j.optString("avatar");
//                            int id = j.optInt("uid");
//                            String bottom = j.optString("uname");
//                            int space_privacy = j.optInt("space_privacy");
//                            /*接口增加认证图标，显示用户认证图标 8.7.2017*/
//                            String user_group = null;
//                            JSONArray array = j.optJSONArray("user_group");
//                            if (array != null && !array.isNull(0)){
//                                user_group = array.optString(0);
//                            }
//                            FindListviewModel f = new FindListviewModel(url, "", bottom, id, 1);
//                            f.setSpace_privacy(space_privacy);
//                            f.setUser_group(user_group);
//                            data.add(f);
//                        }
//                    }
//                    adapter_find.refresh(data);
//                    if (data.size() == 0) {
//                        lv_find.setVisibility(View.GONE);
//                    } else {
//                        lv_find.setVisibility(View.VISIBLE);
//                    }
//                }
//                if (js.has("near_users")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray near_users = js.optJSONArray("near_users");
//                    if (near_users != null && near_users.length() > 0) {
//                        for (int i = 0; i < near_users.length(); i++) {
//                            JSONObject j = (JSONObject) near_users.optJSONObject(i);
//                            String url = j.optString("avatar");
//                            int id = j.optInt("uid");
//                            String bottom = j.optString("uname");
//                            int space_privacy = j.optInt("space_privacy");
//                             /*接口增加认证图标，显示用户认证图标 8.7.2017*/
//                            String user_group = null;
//                            JSONArray array = j.optJSONArray("user_group");
//                            if (array != null && !array.isNull(0)){
//                                user_group = array.optString(0);
//                            }
//                            FindListviewModel f = new FindListviewModel(url, "", bottom, id, 1);
//                            f.setSpace_privacy(space_privacy);
//                            f.setUser_group(user_group);
//                            data.add(f);
//                        }
//                    }
//                    adapter_near.refresh(data);
//                    if (data.size() == 0) {
//                        lv_near.setVisibility(View.GONE);
//                    } else {
//                        lv_near.setVisibility(View.VISIBLE);
//                    }
//                }
//                if (js.has("gifts")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray gifts = js.optJSONArray("gifts");
//                    if (gifts != null && gifts.length() > 0) {
//                        for (int i = 0; i < gifts.length(); i++) {
//                            JSONObject j = (JSONObject) gifts.get(i);
//                            String url = j.getString("image");
//                            int id = j.getInt("id");
//                            String center = j.getString("name");
//                            data.add(new FindListviewModel(url, center, "", id, 0));
//                        }
//                    }
//                    if (data.size() == 0) {
//                        lv_gift.setVisibility(View.GONE);
//                    } else {
//                        lv_gift.setVisibility(View.VISIBLE);
//                    }
//                    adapter_gift.refresh(data);
//                }
//                if (js.has("event")) {
//                    List<FindListviewModel> data = new ArrayList<>();
//                    JSONArray event = js.optJSONArray("event");
//                    if (event != null && event.length() > 0) {
//                        for (int i = 0; i < event.length(); i++) {
//                            JSONObject j = (JSONObject) event.get(i);
//                            String url = j.optString("image");
//                            int id = j.optInt("eid");
//                            String center = j.optString("name");
//                            data.add(new FindListviewModel(url, "", center, id, 1));
//                        }
//                    }
//                    if (data.size() == 0) {
//                        lv_event.setVisibility(View.GONE);
//                    } else {
//                        lv_event.setVisibility(View.VISIBLE);
//                    }
//                    adapter_event.refresh(data);
//                }
////                if (js.has("jipu_goods")) {
////                    List<FindListviewModel> data = new ArrayList<>();
////                    JSONArray jipuGoods = js.optJSONArray("jipu_goods");
////                    if (jipuGoods != null && jipuGoods.length() > 0) {
////                        for (int i = 0; i < jipuGoods.length(); i++) {
////                            JSONObject j = (JSONObject) jipuGoods.get(i);
////                            String url = j.getString("cover_path");
////                            int id = j.getInt("id");
////                            String center = j.getString("name");
////                            data.add(new FindListviewModel(url, center, "", id, 0));
////                        }
////                    }
////                    if (data.size() == 0) {
////                        lv_jipu.setVisibility(View.GONE);
////                    } else {
////                        lv_jipu.setVisibility(View.VISIBLE);
////                    }
////                    adapter_jipu.refresh(data);
////                }
//
//            } catch (JSONException e) {
//                e.printStackTrace();
//            }
//        }
//    };
//
//    /**
//     * 初始化定位参数
//     */
//    public void initOptions() {
//        locationClient = new AMapLocationClient(getActivity().getApplicationContext());
//        locationOption = new AMapLocationClientOption();
//        // 设置定位模式为高精度模式
//        locationOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
//        locationOption.setOnceLocation(true);
//        // 设置定位监听
//        locationClient.setLocationListener(this);
//
//        // 设置定位参数
//        locationClient.setLocationOption(locationOption);
//        // 启动定位
//        locationClient.startLocation();
//    }
//
//    public static FragmentFind newInstance(int unread) {
//        if (fragmentFind == null) {
//            fragmentFind = new FragmentFind();
//        }
//        if (!fragmentFind.isAdded()) {
//            Bundle bundle = new Bundle();
//            bundle.putInt("unread", unread);
//            fragmentFind.setArguments(bundle);
//        }
//        return fragmentFind;
//    }
//
//    @Override
//    public void onAttach(Activity activity) {
//        super.onAttach(activity);
//        if (getArguments() != null) {
//            weibaUnread = getArguments().getInt("unread", 0);
//        }
//        if (activity instanceof UnreadMessageListener)
//            this.listener = (UnreadMessageListener) activity;
//    }
//
//    @Override
//    public int getLayoutId() {
//        return R.layout.fragment_find;
//    }
//
//    /**
//     * 设置微吧消息未读数
//     *
//     * @param notification
//     */
//    public void setWeibaUnreadCount(ModelNotification notification) {
//        int count = notification.getWeibaComment();
//        weibaUnread = count;
//    }
//
//    @Override
//    public void initView() {
//        tv_center = (TextView) findViewById(R.id.tv_center);
//        tv_center.setText(R.string.title_find);
//        mSmartRefreshLayout = (SmartRefreshLayout) findViewById(R.id.smart_refresh_layout);
//        mSmartRefreshLayout.setEnableLoadmore(false);
//        // 发现
//        ll_find_topic = (LinearLayout) findViewById(R.id.ll_topic);
//        ll_find_channal = (LinearLayout) findViewById(R.id.ll_channel);
//        ll_find_info = (LinearLayout) findViewById(R.id.ll_info);
//        ll_find_find = (LinearLayout) findViewById(R.id.ll_find);
//        ll_find_gift = (LinearLayout) findViewById(R.id.ll_gift);
//        ll_find_jipu = (LinearLayout) findViewById(R.id.ll_jipu);
//        ll_find_weiba = (LinearLayout) findViewById(R.id.ll_weiba);
//        ll_find_near = (LinearLayout) findViewById(R.id.ll_near);
//        ll_zhibo = (LinearLayout) findViewById(R.id.ll_zhibo);
//        ll_find_event = (LinearLayout) findViewById(R.id.ll_event);
//
//        lv_zhibo = (HorizontalListView) findViewById(R.id.lv_zhibo);
//        lv_weiba = (HorizontalListView) findViewById(R.id.lv_weiba);
//        lv_chanel = (HorizontalListView) findViewById(R.id.lv_chanel);
//        lv_huati = (HorizontalListView) findViewById(R.id.lv_huati);
//        lv_zixun = (HorizontalListView) findViewById(R.id.lv_zixun);
//        lv_find = (HorizontalListView) findViewById(R.id.lv_find);
//        lv_near = (HorizontalListView) findViewById(R.id.lv_near);
//        lv_gift = (HorizontalListView) findViewById(R.id.lv_gift);
//        lv_jipu = (HorizontalListView) findViewById(R.id.lv_jipu);
//        lv_event = (HorizontalListView) findViewById(R.id.lv_event);
//
//
//        list_item_height = (SociaxUIUtils.getWindowWidth(getActivity()) - SociaxUIUtils.dip2px(getActivity(), 50));
//        list_item_height_five = (SociaxUIUtils.getWindowWidth(getActivity()) - SociaxUIUtils.dip2px(getActivity(), 60));
//        int lvHeight = list_item_height / 4 + SociaxUIUtils.dip2px(getActivity(), 25);// 平分 4
//        int lvHeight_near = list_item_height_five / 5 + SociaxUIUtils.dip2px(getActivity(), 25);// 平分 5
//        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
//        LinearLayout.LayoutParams params_near = new LinearLayout.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.WRAP_CONTENT);
//
//        params.setMargins(SociaxUIUtils.dip2px(getActivity(), 10), SociaxUIUtils.dip2px(getActivity(), 14), 0, SociaxUIUtils.dip2px(getActivity(), 14));
//        params_near.setMargins(SociaxUIUtils.dip2px(getActivity(), 10), SociaxUIUtils.dip2px(getActivity(), 14), 0, SociaxUIUtils.dip2px(getActivity(), 14));
//        params.height = lvHeight;
//        params_near.height = lvHeight_near;
//
//        // 4d等分的每个item
//        LinearLayout.LayoutParams Params_four = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
//        Params_four.width = list_item_height / 4;
//        Params_four.height = list_item_height / 4;
//        Params_four.setMargins(0, 0, SociaxUIUtils.dip2px(getActivity(), 10), 0);
//
//        // 5等分的每个item
//        LinearLayout.LayoutParams Params_five = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
//        Params_five.width = list_item_height_five / 5;
//        Params_five.height = list_item_height_five / 5;
//        Params_five.setMargins(0, 0, SociaxUIUtils.dip2px(getActivity(), 10), 0);
//
//        // 咨询的每个item
//        LinearLayout.LayoutParams Params_zixun = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
//        Params_zixun.width = SociaxUIUtils.dip2px(getActivity(), 100);
//        Params_zixun.height = SociaxUIUtils.dip2px(getActivity(), 86);
//        Params_zixun.setMargins(0, 0, SociaxUIUtils.dip2px(getActivity(), 10), 0);
//
//        // 商城的每个item
//        LinearLayout.LayoutParams Params_shop = new LinearLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
//        Params_shop.width = SociaxUIUtils.dip2px(getActivity(), 100);
//        Params_shop.height = SociaxUIUtils.dip2px(getActivity(), 100);
//        Params_shop.setMargins(0, 0, SociaxUIUtils.dip2px(getActivity(), 10), 0);
//
//
//        lv_zhibo.setLayoutParams(params);
//        lv_weiba.setLayoutParams(params);
//        lv_chanel.setLayoutParams(params);
//        lv_huati.setLayoutParams(params);
//        lv_find.setLayoutParams(params_near);
//        lv_near.setLayoutParams(params_near);
//
//
//        adapter_zhibo = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_four);
//        adapter_weiba = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_four);
//        adapter_huati = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_four);
//        adapter_chanel = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_four);
//        adapter_zixun = new AdapterFindListview(getActivity(), null, false, MAX_LINE_TWO, Params_zixun);
//        adapter_find = new AdapterFindListview(getActivity(), null, true, MAX_LINE_ONE, Params_five);
//        adapter_near = new AdapterFindListview(getActivity(), null, true, MAX_LINE_ONE, Params_five);
//        adapter_gift = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_shop);
//        adapter_jipu = new AdapterFindListview(getActivity(), null, false, MAX_LINE_TWO, Params_shop);
//        adapter_event = new AdapterFindListview(getActivity(), null, false, MAX_LINE_ONE, Params_zixun);
//
//        lv_zhibo.setAdapter(adapter_zhibo);
//        lv_weiba.setAdapter(adapter_weiba);
//        lv_chanel.setAdapter(adapter_chanel);
//        lv_huati.setAdapter(adapter_huati);
//        lv_zixun.setAdapter(adapter_zixun);
//        lv_find.setAdapter(adapter_find);
//        lv_near.setAdapter(adapter_near);
//        lv_gift.setAdapter(adapter_gift);
//        lv_jipu.setAdapter(adapter_jipu);
//        lv_event.setAdapter(adapter_event);
//
//        initOptions();
//        initAds();
//        inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//        smallAddDialog = new SmallDialog(getActivity(), getResources().getString(R.string.loading_more));
//    }
//
//    private void initAds() {
//        // 广告栏
//        fc_ads = (FunctionAdvertise) findViewById(R.id.fc_ads);
//        // 设置广告栏高度
//        int width = UnitSociax.getWindowWidth(getActivity());
//        int height = (int) (((double) 9) / ((double) 16) * width);
//        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(width, height);
//        fc_ads.setLayoutParams(params);
//    }
//
//    @Override
//    public void initIntentData() {
//
//    }
//
//    @Override
//    public void initListener() {
//        lv_zhibo.setOnItemClickListener(this);
//        lv_weiba.setOnItemClickListener(this);
//        lv_huati.setOnItemClickListener(this);
//        lv_chanel.setOnItemClickListener(this);
//        lv_zixun.setOnItemClickListener(this);
//        lv_find.setOnItemClickListener(this);
//        lv_near.setOnItemClickListener(this);
//        lv_gift.setOnItemClickListener(this);
//        lv_jipu.setOnItemClickListener(this);
//        lv_event.setOnItemClickListener(this);
//        mSmartRefreshLayout.setOnRefreshListener(this);
//
//        // 话题
//        ll_find_topic.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(getActivity(), ActivityTopicList.class);
//                startActivity(intent);
//            }
//        });
//        // 频道
//        ll_find_channal.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//
//                Intent intent = new Intent(getActivity(), ActivityChannel.class);
//                startActivity(intent);
//            }
//        });
//        // 资讯
//        ll_find_info.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//
//                Intent intent = new Intent(getActivity(), ActivityInformation.class);
//                startActivity(intent);
//            }
//        });
//        // 找人
//        ll_find_find.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(getActivity(),
//                        ActivityFindPeople.class);
//                startActivity(intent);
//            }
//        });
//        // 礼物/积分商城
//        ll_find_gift.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//
//                Intent intent = new Intent(getActivity(), ActivityScoreShop.class);
//                startActivity(intent);
//
//            }
//        });
//        // 极铺商城
//        ll_find_jipu.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(getActivity(), JiPuShopActivity.class);
//                startActivity(intent);
//            }
//        });
//        // 微吧
//        ll_find_weiba.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(getActivity(), ActivityWeiba.class);
//                intent.putExtra("unread", weibaUnread);
//                startActivity(intent);
//
//            }
//        });
//
//        // 附近的人
//        ll_find_near.setOnClickListener(new OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                Intent intent = new Intent(getActivity(), ActivitySearchUser.class);
//                intent.putExtra("type", StaticInApp.FINDPEOPLE_NEARBY);
//                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//                startActivity(intent);
//            }
//        });
//
//        // 活动
//        ll_find_event.setOnClickListener(new OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                Intent intent = new Intent(getActivity(), EventActivity.class);
//                startActivity(intent);
//            }
//        });
//
//    }
//
//    // 获取发现界面的数据
//    public void getFindData(final double latitude, final double longitude) {
//        if (weiba_data == null && !mSmartRefreshLayout.isRefreshing()) {// 没有数据的时候显示弹框，有数据的时候更新不显示
//            smallAddDialog.show();
//        }
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                String result = "";
//                try {
//                    result = new Api.Credit().getFindFragmentData(latitude, longitude, NEEDS, NEEDS_TYPE);
//                    // 将获取到的数据加入缓存，如果没获取到，就从缓存中读取
//                    if (!TextUtils.isEmpty(result)) {
//                        saveToCache(result, CACHE_KEY);
//                    }
//                } catch (ApiException e) {
//                    e.printStackTrace();
//                } finally {
//                    if (TextUtils.isEmpty(result)) {
//                        result = getCache(CACHE_KEY);
//                    }
//                    Message msg = myHandler.obtainMessage();
//                    msg.obj = result;
//                    msg.sendToTarget();
//                }
//            }
//        }).start();
//    }
//
//    @Override
//    public void initData() {
//    }
//
//    @Override
//    public void onPause() {
//        super.onPause();
//    }
//
//    @Override
//    public void onStop() {
//        fc_ads.stopAutoCycle();
//        super.onStop();
//    }
//
//    @Override
//    public void onResume() {
//        if (!fc_ads.isCycling()) {
//            fc_ads.startCycle();
//        }
//        super.onResume();
//    }
//
//    @Override
//    public void onDetach() {
//        fragmentFind = null;
//        super.onDetach();
//    }
//
//    /**
//     * 清除新消息提醒
//     */
//    public void clearUnreadMsg() {
//        // 消除主界面的消息未读数
//        weibaUnread = 0;
//        if (listener != null) {
//            listener.clearUnreadMessage(StaticInApp.UNREAD_WEIBA, weibaUnread);
//        }
//    }
//
//    @Override
//    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//        Intent intent;
//        FindListviewModel data = null;
//        switch (parent.getId()) {
//            case R.id.lv_zhibo:
//                break;
//            case R.id.lv_weiba:
//
//                ModelWeiba weiba = weiba_data.get(position);
//                intent = new Intent(getActivity(), ActivityWeibaDetail.class);
//                intent.putExtra("weiba", (Serializable) weiba);
//                startActivity(intent);
//                break;
//            case R.id.lv_huati:
//
//                data = (FindListviewModel) adapter_huati.getItem(position);
//                intent = new Intent(getActivity(), ActivityTopicWeibo.class);
//                intent.putExtra("topic_id", data.getId());
//                intent.putExtra("topic_name", data.getTv_center());
//                startActivity(intent);
//                break;
//            case R.id.lv_chanel:
//                data = (FindListviewModel) adapter_chanel.getItem(position);
//                intent = new Intent(getActivity(), ActivityChannelWeibo.class);
//                intent.putExtra("channel_id", data.getId());
//                intent.putExtra("channel_name", data.getTv_center());
//                startActivity(intent);
//
//                break;
//            case R.id.lv_zixun:
//                data = (FindListviewModel) adapter_zixun.getItem(position);
//
//                intent = new Intent(getActivity(), InformationDetailsActivity.class);
//                //
//                intent.putExtra("id", data.getId());
//                intent.putExtra("subject",data.getTv_bottom());
//                getActivity().startActivity(intent);
//
//                break;
//            case R.id.lv_find:
//                data = (FindListviewModel) adapter_find.getItem(position);
//                if (Thinksns.getMy().getUid() != data.getId() && data.getSpace_privacy() == ModelUser.CAN_NOT_TO_HOME) {
//                    ToastUtils.showToast("您没有权限查看他的个人主页");
//                    return;
//                }
//                intent = new Intent(getActivity(), ActivityUserInfo_2.class);
//                intent.putExtra("uid", data.getId());
//                startActivity(intent);
//                break;
//            case R.id.lv_near:
//                data = (FindListviewModel) adapter_near.getItem(position);
//                if (Thinksns.getMy().getUid() != data.getId() && data.getSpace_privacy() == ModelUser.CAN_NOT_TO_HOME) {
//                    ToastUtils.showToast("您没有权限查看他的个人主页");
//                    return;
//                }
//                intent = new Intent(getActivity(), ActivityUserInfo_2.class);
//                intent.putExtra("uid", data.getId());
//                startActivity(intent);
//
//                break;
//            case R.id.lv_gift:
//                data = (FindListviewModel) adapter_gift.getItem(position);
//                ModelShopGift gift = new ModelShopGift();
//                gift.setId(data.getId() + "");
//                intent = new Intent(getActivity(), ActivityGiftDetail.class);
//                intent.putExtra("modelGift", gift);
//                startActivity(intent);
//                break;
//            case R.id.lv_jipu://极铺接入
//                data = (FindListviewModel) adapter_jipu.getItem(position);
//                intent = new Intent(getActivity(), JiPuShopActivity.class);
//                intent.putExtra(JiPuShopActivity.BUNDLE_ID, data.getId() + "");
//                startActivity(intent);
//                break;
//            case R.id.lv_event:
//                Intent intent1 = new Intent(getActivity(), EventDetailActivity.class);
//                intent1.putExtra("eid", ((FindListviewModel)adapter_event.getItem(position)).getId());
//                startActivity(intent1);
//                break;
//        }
//
//
//    }
//
//    @Override
//    public void onLocationChanged(AMapLocation aMapLocation) {
//        if (aMapLocation != null) {
//            if (aMapLocation.getErrorCode() == 0) {
//                mLatitude = aMapLocation.getLatitude();
//                mLongitude = aMapLocation.getLongitude();
//                getFindData(mLatitude, mLongitude);
//
//            } else {
//                String errText = "定位失败," + aMapLocation.getErrorCode() + ": " + aMapLocation.getErrorInfo();
//                ToastUtils.showLongToast(getActivity(), "定位失败");
//                String cache = getCache(CACHE_KEY);
//                if (!TextUtils.isEmpty(cache)) {
//                    Message msg = myHandler.obtainMessage();
//                    msg.obj = cache;
//                    msg.sendToTarget();
//                }
//            }
//        }
//    }
//
//    @Override
//    public void onDestroy() {
//        if (null != locationClient) {
//            locationClient.onDestroy();
//            locationClient = null;
//            locationOption = null;
//        }
//        super.onDestroy();
//    }
//
//    /**
//     * 保存到缓存中
//     *
//     * @param data
//     * @param key
//     */
//    private void saveToCache(String data, String key) {
//        CacheManager.saveObject(getActivity(), data, key);
//    }
//
//    /**
//     * 从缓存中读取数据
//     *
//     * @param key
//     * @return
//     */
//    private String getCache(String key) {
//        if (CacheManager.isExistDataCache(getActivity(), key)) {
//            return String.valueOf(CacheManager.readObject(getActivity(), key));
//        }
//        return null;
//    }
//
//    @Override
//    public void onRefresh(RefreshLayout refreshlayout) {
//        getFindData(mLatitude, mLongitude);
//    }
//}
